<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>03-获取表单元素</title>
    <script>
      window.onload = function () {
        // 获取表单
        let form1 = document.form1;
        console.log(form1);
        // 获取表单提交按钮的值
        let submit = document.form1.submit;
        console.log(submit);
        // 获取文本输入的东西
        let username = document.form2.username;
        console.log(username);
      }
    </script>
</head>
<body>
    <form action="#" method="get" name = "form1">
      <input type="text" name="username" value="张三">
      <input type="text" name="password" value="123">
      <input type="text" name="age" value="19">
      <input type="submit" name="submit" value="提交">
    </form>
    <form action="#" method="get" name = "form2">
      <input type="text" name="username" value="李四">
      <input type="text" name="password" value="456">
      <input type="text" name="age" value="33">
    </form>
</body>
</html>